#include "msp430f5309.h"
#include "led.h"

void main()
{
	WDTCTL = WDTPW + WDTHOLD;
#if 1

    // Configure PU.0 as output pins
    LDOKEYPID = 0x9628;                       // Enable access to config registers 
	LDOPWRCTL = LDOOEN;
    PUCTL |= PUOPE;
    PUCTL &= ~PUOUT0;             // XOR PU.0/1    
    PUCTL &= ~PUOUT1;             // XOR PU.0/1    
    LDOKEYPID = 0x0;                          // Disbale access to config registers  
    
	P1DIR = 0xff;
	P1OUT = 0x00;

	P2DIR = 0x01;
	P2OUT = 0x00;

	P4DIR = 0xff;
	P4OUT = 0x00;

	P5DIR = 0x1f;
	P5OUT = 0x00;

	P6DIR = 0x0f;
	P6OUT = 0x00;

	PJDIR = 0x0f;
	PJOUT = 0x00;
#endif
    
      // Disable SVS
    PMMCTL0_H = PMMPW_H;                // PMM Password
    SVSMHCTL &= ~(SVMHE+SVSHE);         // Disable High side SVS 
    SVSMLCTL &= ~(SVMLE+SVSLE);         // Disable Low side SVS

	__bis_SR_register(LPM4_bits + GIE); // Enter LPM3
	__no_operation();
    __no_operation();
}